import { DateChain } from '../dist/index';

function DateChainTest() {
    const now = new DateChain(undefined).dateFormat('YYYY-MM-dd HH:mm:ss');
    console.log('now ==> ' + now);
    try {
        const invalidDate = new DateChain(new Date('xxxx'));
        console.log(invalidDate.dateFormat());
    } catch (e) {
        // console.error(e);
        console.log('非法参数');
    }
    const date = new DateChain(new Date(2022,5,18)).getDateOfInterval(1);
    console.log('date ==> ' + JSON.stringify(date));
    const dateFmt = new DateChain(new Date(2022,6,18)).getDateOfInterval(10).dateFormat('YYYY-MM-dd HH:mm:ss');
    console.log('dateFmt ==> ' + dateFmt);
}

DateChainTest();
